# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


# useful for handling different item types with a single interface
from itemadapter import ItemAdapter

import re

class FacePipeline:
    def process_item(self, item, spider):
        path = r'G:\novel'
        file=open(path+'\\'+'无疆.txt','a+',encoding='utf-8')
        file.write(item['chapter'][0]+'\n\n')
        for each in item['content']:
            file.write(''.join(each.split())+'\n\n')
        return item
